import {Injectable} from '@angular/core';
import {ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot, UrlTree} from '@angular/router';
import {Observable} from 'rxjs';
import {PermissionsService} from '../../service/permissions/permissions.service';

@Injectable({
    providedIn: 'root'
})
export class ValidationGuard implements CanActivate {
    constructor(
        private permisstions: PermissionsService
    ) {

    }

    canActivate(
        route: ActivatedRouteSnapshot,
        state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
        return this.permisstions.canActivate();
    }
}
